package bsh;

import bsh.compilation.CompilationOptions;
import bsh.compilation.CompilationResults;
import bsh.compilation.CompilationSource;
import bsh.exception.CompilationFailedException;

/**
 * Interface principal de {@link Compiler}
 * 
 * @author takeshi
 */
public interface Compiler {

    /**
     * Faz a compilacao com os parametros default
     * 
     * @param source {@link CompilationSource}
     * @return {@link CompilationResults}
     * @throws ParseException e
     * @throws CompilationFailedException e
     */
    CompilationResults compile(CompilationSource source) throws ParseException, CompilationFailedException;

    /**
     * Faz a compilacao usando os parametros passados
     * 
     * @param source {@link CompilationSource}
     * @param options {@link CompilationOptions}
     * @return {@link CompilationResults}
     * @throws ParseException e
     * @throws CompilationFailedException e
     */
    CompilationResults compileOverrideOptions(CompilationSource source, CompilationOptions options) throws ParseException,
            CompilationFailedException;

    /**
     * Compiles a script as a {@link Trait}
     * 
     * @param source the {@link CompilationSource}
     * @return {@link Trait}
     * @throws ParseException e
     * @throws CompilationFailedException e
     */
    Trait compileAsTrait(CompilationSource source) throws ParseException, CompilationFailedException;

    /**
     * Compiles a script as a {@link Trait}
     * 
     * @param source the {@link CompilationSource}
     * @param options {@link CompilationOptions}
     * @return {@link Trait}
     * @throws ParseException e
     * @throws CompilationFailedException e
     */
    Trait compileAsTrait(CompilationSource source, CompilationOptions options) throws ParseException, CompilationFailedException;
}
